<html>
<head><title>User interface with JSP</title></head>
<body>
<h1>Looking for someone ?</h1><br>
<form method ="get">
<p>
Name:&nbsp;<input type="text" name="prefix"/>
<br/><input type="submit" name="searchPerson" value ="Search !"/>
<br/><input type="submit" name="searchallPerson" value ="Search All !"/>
</p>
</form>
<h1>Looking for a card ?</h1><br>
<form method ="get">
<p>
Name:&nbsp;<input type="text" name="prefix"/>
<br/><input type="submit" name="searchCard" value ="Search !"/>
<br/><input type="submit" name="searchallCard" value ="Search All !"/>
</p>
</form>
<%
boolean all = request.getParameter("searchallPerson")!=null;
if(all)
	out.println("prefix ="+request.getParameter("prefix"));		
%>
<jsp:useBean id="ConsultPersonneBean" scope="request" class="tpcar.ejb.ConsultPersonneBean" >

</jsp:useBean>
<%
List<Personne> personnes =  ConsultPersonneBean.listerTous();
if (personnes == null|| personnes.isEmpty()) {
	out. println ("<strong> No match found ! </strong>");
}else {
	for (Personne personne : personnes) {
		out.println("<h4>" + personne.getNom () + " " + personne.getPrenom() + "</h4>");
		out.println("<ul>");
		out.println("<li>Place of Birth: "+ personne.getLieuNaissance() +"</li>");
		out.println("<li>Date of Birth: "+ personne.getDateNaissance() +"</li>");
		out.println("<li>Gender: "+ personne.getSexe() +"</li>");
		out.println("</ul>");
	}
}
%>

</body>
</html>